<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!--返回错误信息-->
<?php echo validation_errors(); ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <?php
    $title = [
        'title' => '审核管理',
    ];
    $this->load->view('/admin/common/header', $title);
    ?>
</head>

<body data-type="widgets">
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

<!--    头部   侧边菜单-->
    <?php $this->load->view('/admin/common/bodyLeft'); ?>
    <script type="text/javascript">
    	$(".js-sidebar-nav>li:nth-child(2)>a").addClass("active");
    </script>
    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">

        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title  am-cf">审核管理</div>
                        </div>
                        <div class="widget-body  am-fr">
                            <div class="am-u-sm-12 am-u-md-6 am-u-lg-6 am-form-group">
                                <div class="am-btn-toolbar">
                                    <div class="am-alert am-alert-danger" id="data-alert" style="display: none;margin: 4px 0 10px 10px;font-size: 1.6rem;">
                                        <p>开始日期应小于结束日期</p>
                                    </div>
                                    <div class="am-g">
                                        <div class="am-u-sm-6">
                                            <button type="button" class="am-btn am-btn-default am-margin-right" id="my-start">开始日期</button><span id="my-startDate"></span>
                                        </div>
                                        <div class="am-u-sm-6">
                                            <button type="button" class="am-btn am-btn-default am-margin-right" id="my-end">结束日期</button><span id="my-endDate"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">

                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                                    <div class="am-form-group tpl-table-list-select">
                                        <select data-am-selected="{btnSize: 'sm',btnWidth: '100%'}" id="getStatus">
                                            
                                            <?php
                                                if($_GET['type'] == 1){
                                                    echo '
                                                        <option value="null">请选择状态</option>
                                                        <option value="0" >待审核</option>
                                                        <option value="1" >已审核</option>
                                                    ';   
                                                }else if($_GET['type'] == 2){
                                                    echo '
                                                        <option value="null">请选择状态</option>
                                                        <option value="0" >待评分</option>
                                                        <option value="1" >已评分</option>
                                                    ';  
                                                }else{
                                                    echo '
                                                        <option value="null">请选择状态</option>
                                                        <option value="0" >待定标</option>
                                                        <option value="1" >已定标</option>
                                                    '; 
                                                }
                                            ?>
                                        </select>
                                    </div>
                                </div>
<!--                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">-->
<!--                                    <div class="am-form-group am-input-group am-input-group-sm tpl-form-border-form cl-p">-->
<!--                                        <input type="text" class="am-form-field" name="search" id="searchValue" placeholder="请输入项目或单据名称">-->
<!--                                        <span class="am-input-group-btn">-->
<!--                                            <a href="javascript:void(0);" id="search" class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search">搜索</a>-->
<!--                                        </span>-->
<!--                                    </div>-->
<!--                                </div>-->
                                
                            </div>
                            
                            <div class="am-u-sm-12">
                                <div class="am-btn-toolbar am-u-sm-12" >
                                    <div class=" am-btn-group-xs" id="type">
                                        <a href="javascript:void(0);" onclick="dai()" class="am-btn   <?php if(isset($_GET['type']) && $_GET['type'] == 1){echo 'am-btn-primary';}  else {echo 'am-btn-default';}?> ">进货单</a>
                                        <a href="javascript:void(0);" onclick="yi()" class="am-btn  <?php if(isset($_GET['type']) && $_GET['type'] == 2){echo 'am-btn-primary ';} else {echo 'am-btn-default';}?> ">招投标评审</a>
                                        <a href="javascript:void(0);" onclick="yi2()" class="am-btn  <?php if(isset($_GET['type']) && $_GET['type'] == 3){echo 'am-btn-primary ';} else {echo 'am-btn-default';}?> ">招投标定标</a>

                                    </div>
                                </div>
                            </div>
                            <div class="am-u-sm-12">
                                <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black "
                                       id="example-r">
                                    <thead>
                                    <?php
                                        if(isset($list)){
                                            echo '<tr>
                                        <th>单据编号</th>
                                        <th>单据类型</th>
                                        <th>单据名称</th>
                                        <th>发起时间</th>
                                        <th>所属项目</th>
                                        <th>发起人</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                    </tr>';
                                        }else{
                                            echo '<tr>
                                        <th>招投标项目编号</th>
                                        <th>项目名称</th>
                                        <th>发布时间</th>
                                        <th>招标金额</th>
                                        <th>地区</th>
                                        <th>保证金金额</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                    </tr>';
                                        }
                                    ?>

                                    </thead>
                                    <tbody class="choose-box">
                                    <?php
                                    if(isset($list) && $list){
                                        foreach ($list as $v) {
//                                            $v['contactMan'] = isset($v['contactMan']) ? $v['contactMan'] : '';

                                            if(isset($v['createMan'])){
                                                $man = $v['createMan'];

                                            }elseif(isset($v['contactMan'])){
                                                $man = $v['contactMan'];

                                            }else{
                                                $man = '';

                                            }

                                            echo '<tr class="gradeX">';
                                            if(isset($v['needCode'])){
                                                echo '<td><a href="/admin/check/detail?id='.$v['id'].'&type='.$v['type'].'&checkId='.$v['checkId'].'&checkStatus='.$v['checkStatus'].'&status='.$v['status'].'">'.$v['needCode'].'</a></td>';

                                            }elseif (isset($v['code'])){
                                                echo '<td><a href="/admin/check/detail?id='.$v['id'].'&type='.$v['type'].'&checkId='.$v['checkId'].'&checkStatus='.$v['checkStatus'].'&status='.$v['status'].'">'.$v['code'].'</a></td>';

                                            }elseif (isset($v['purchaseCode'])){
                                                echo '<td><a href="/admin/check/detail?id='.$v['id'].'&type='.$v['type'].'&checkId='.$v['checkId'].'&checkStatus='.$v['checkStatus'].'&status='.$v['status'].'">'.$v['purchaseCode'].'</a></td>';
                                            }elseif (isset($v['stockOutCode'])){
                                                echo '<td><a href="/admin/check/detail?id='.$v['id'].'&type='.$v['type'].'&checkId='.$v['checkId'].'&checkStatus='.$v['checkStatus'].'&status='.$v['status'].'">'.$v['stockOutCode'].'</a></td>';
                                            }elseif (isset($v['stockPutCode'])){
                                                echo '<td><a href="/admin/check/detail?id='.$v['id'].'&type='.$v['type'].'&checkId='.$v['checkId'].'&checkStatus='.$v['checkStatus'].'&status='.$v['status'].'">'.$v['stockPutCode'].'</a></td>';
                                            }
                                             echo '<td>'.$v['type'].'</td>
                                             <td>'.$v['name'].'</td>
                                             <td>'.date('Y-m-d',$v['createTime']).'</td>
                                            <td>'.$v['source'].'</td>
                                            
                                            <td>'.$man.'</td>';

                                            if($v['status'] == 0){
                                                echo '<td>待审核</td><td>
                                                <div class="tpl-table-black-operation">
                                                <input type="hidden" class="uri" value="/admin/check/edit?id='.$v['checkId'].'&checkStatus='.$v['checkStatus'].'&proId='.$v['id'].'&type='.$v['type'].'">
                                                
                                                <a href="javascript:;" data-am-modal="{target: \'#grade-box-success\', closeViaDimmer: 0, width: 400, height: 250}" class="click-success"><i class="am-icon-paint-brush" ></i> 审核通过 </a>
                                                <a href="javascript:;" data-am-modal="{target: \'#grade-box-ref\', closeViaDimmer: 0, width: 400, height: 250}" class="tpl-table-black-operation-del click-ref"><i class="am-icon-close" ></i> 审核拒绝 </a>
                                                        
                                            </div>
                                            </td>
                                           </tr>';
                                            }elseif($v['status'] == 1){
                                                echo '<td>已审核</td> 
                                                <td>
                                                    
                                                </td>
                                            </tr>';
                                            }elseif ($v['status'] == 2){
                                                echo '<td>已审核</td>
                                                <td>
                                                     <div class="tpl-table-black-operation">
                                                         <a href="javascript:void(0);" class="am-btn am-btn-default am-disabled">审核已拒绝 </a>
                                                    </div>
                                                </td>
                                            </tr>';
                                            }

                                        }
                                    }else{
                                        if(isset($ztblist) && $ztblist){
                                            foreach ($ztblist as $v) {
                                                echo '<tr class="gradeX">';
                                                if(isset($v['isType']) && $v['isType'] == '招标项目定标'){
                                                    echo '<td><a href="/admin/bidding/confirmDetail?id='.$v['checkId'].'&relevanceId='.$v['relevanceId'].'">'.$v['code'].'</a></td>';

                                                }else{
                                                    echo '<td><a href="/admin/bidding/checkDetail?id='.$v['id'].'">'.$v['code'].'</a></td>';
                                                }
                                                echo '<td>'.$v['name'].'</td>
                                             <td>'.date('Y-m-d',$v['createTime']).'</td>
                                            <td>招标金额</td>
                                            <td>'.$v['address'].'</td>
                                            <td>'.$v['needAmount'].'</td>';

                                                if(isset($v['isType']) && $v['isType'] == '招标项目定标'){
                                                    if($v['status'] == 0){
                                                        echo '<td>待定标</td><td><div class="tpl-table-black-operation">
                                                 <a href="/admin/bidding/confirmDetail?id='.$v['checkId'].'&relevanceId='.$v['relevanceId'].'">
                                                        <i class="am-icon-pencil"></i> 去定标
                                                    </a>
                                            </div>
                                            </td>
                                           </tr>';
                                                    }else{
                                                        echo ' <td>已定标</td>
                                            <td>
                                            <div class="tpl-table-black-operation">
                                            </div>
                                            </td>
                                            </tr>';
                                                    }
                                                }else{
                                                    if($v['status'] == 0){
                                                        echo '<td>待评分</td><td><div class="tpl-table-black-operation">
                                                 <a href="/admin/bidding/checkEditView?id='.$v['id'].'&checkId='.$v['checkId'].'">
                                                        <i class="am-icon-pencil"></i> 去评分
                                                    </a>
                                              
                                            </div>
                                            </td>
                                           </tr>';
                                                    }elseif($v['status'] == 1){
                                                        echo ' <td>已评分</td>
                                            <td>
                                            <div class="tpl-table-black-operation">
                                            </div>
                                            </td>
                                            </tr>';
                                                    }
                                                }
                                            }

                                        }else{
                                            echo '';
                                        }
                                    }
                                    ?>
                                    </tbody>
                                </table>
                            </div>
                            <div class="am-u-lg-12">
                                <div class="am-u-sm-centered">
                                    <ul class="am-pagination am-pagination-centered" id="paging">
                                        

                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

<!-- 审核通过模态框 -->
<div class="am-modal am-modal-no-btn" tabindex="-1" id="grade-box-success">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">通过理由
            <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
        </div>
        <div class="am-modal-bd">
            <form class="am-form am-form-horizontal">
                <div class="am-form-group">
                    <div class="am-u-sm-15">
                        <textarea rows="4" id="successContent" maxlength="128"></textarea>
                    </div>
                </div>
            </form>
            <div style="position: relative;top: 25px;">
                <button type="button" class="am-btn am-btn-primary am-u-sm-6" id="confirm-success" data-am-modal-close>确定</button>
                <button type="button" class="am-btn am-btn-danger am-u-sm-6" data-am-modal-close>取消</button>
            </div>
        </div>
    </div>
</div>

<!-- 审核拒绝模态框 -->
<div class="am-modal am-modal-no-btn" tabindex="-1" id="grade-box-ref">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">拒绝理由
            <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
        </div>
        <div class="am-modal-bd">
            <form class="am-form am-form-horizontal">
                <div class="am-form-group">
                    <div class="am-u-sm-15">
                        <textarea rows="4" id="refContent" maxlength="128"></textarea>
                    </div>
                </div>
            </form>
            <div style="position: relative;top: 25px;">
                <button type="button" class="am-btn am-btn-primary am-u-sm-6" id="confirm-ref" data-am-modal-close>确定</button>
                <button type="button" class="am-btn am-btn-danger am-u-sm-6" data-am-modal-close>取消</button>
            </div>
        </div>
    </div>
</div>
<script>

    var successUrl = null;
    var refUrl = null;

    $(".click-success").on("click", function () {
        successUrl = $(this).siblings(".uri").val();
    })

    $(".click-ref").on("click", function () {
        refUrl = $(this).siblings(".uri").val();
    })


    // 点击确定提交审核通过
    $("#confirm-success").on("click",function(){
        var successContent = $("#successContent").val();
        window.location.href = successUrl+'&status=1&content='+successContent
        console.log(successUrl+'&status=1&content='+successContent);
        console.log(successContent)
    });

    // 点击确定提交审核拒绝
    $("#confirm-ref").on("click",function(){

        var refContent = $("#refContent").val();
        window.location.href = refUrl+'&status=2&content='+refContent
        console.log(refUrl+'&status=2&content='+refContent)
        console.log(refContent)
    });
</script>
<script>
    function GetQueryString(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }
    function dai() {
        var search = GetQueryString('search');
        // $(".am-btn-primary").removeClass("am-btn-primary");
        // $(this).addClass("am-btn-primary");

        if(search == null){
            window.location.href='?page=1'+'&type=1'
        }else{
            window.location.href='?page=1'+'&search='+search+'&type=1'
        }
    }
    function yi() {
        var search = GetQueryString('search');
        if(search == null){
            window.location.href='?page=1'+'&type=2'
        }else{
            window.location.href='?page=1'+'&search='+search+'&type=2'

        }
    }
    function yi2() {
        var search = GetQueryString('search');
        if(search == null){
            window.location.href='?page=1'+'&type=3'
        }else{
            window.location.href='?page=1'+'&search='+search+'&type=3'

        }
    }
</script>

<script src="/assets/js/amazeui.min.js"></script>
<script src="/assets/js/amazeui.datatables.min.js"></script>
<script src="/assets/js/dataTables.responsive.min.js"></script>
<script src="/assets/js/app.js"></script>
<script src="/assets/js/page.js"></script>

<script>
    //筛选
    var choose = {};
    var startTime,
        endTime,
        status,
        search,
        page,
        type;

    $("#getStatus").on( "change" , function() {
        startTime = $("#my-startDate").text();
        endTime = $("#my-endDate").text();
        status = $("#getStatus").val();
        search = $("#searchValue").val();
        page = 1;
        type = getType();
        
        chooseCheck(startTime,endTime,search,status,type,page);

    });
    $("#search").on( "click" , function() {
        startTime = $("#my-startDate").text();
        endTime = $("#my-endDate").text();
        status = $("#getStatus").val();
        search = $("#searchValue").val();
        page = 1;
        type = getType();
        
        chooseCheck(startTime,endTime,search,status,type,page);
    });

    //筛选日期
    var startDate = new Date(2014, 11, 20);
    var endDate = new Date(2100, 11, 25);
    var $alert = $('#data-alert');
    $('#my-start').datepicker().on('changeDate.datepicker.amui', function(event) {

        if (event.date.valueOf() > endDate.valueOf()) {
          $alert.find('p').text('开始日期应小于结束日期！').end().show();
          return false;
          
        } else {
          $alert.hide();
          startDate = new Date(event.date);
          $('#my-startDate').text($('#my-start').data('date'));
        }
        $(this).datepicker('close');

        startTime = $("#my-startDate").text();
        endTime = $("#my-endDate").text();
        status = $("#getStatus").val();
        search = $("#searchValue").val();
        page = 1;
        type = getType();
        
        chooseCheck(startTime,endTime,search,status,type,page);
        
    });
    $('#my-end').datepicker().on('changeDate.datepicker.amui', function(event) {
        
        if (event.date.valueOf() < startDate.valueOf()) {
          $alert.find('p').text('结束日期应大于开始日期！').end().show();
          return false;
        } else {
          $alert.hide();
          endDate = new Date(event.date);
          $('#my-endDate').text($('#my-end').data('date'));
        }
        $(this).datepicker('close');

        startTime = $("#my-startDate").text();
        endTime = $("#my-endDate").text();
        status = $("#getStatus").val();
        search = $("#searchValue").val();
        page = 1;
        type = getType();
        
        chooseCheck(startTime,endTime,search,status,type,page);
       
    });

    function getType() {
        var type;
        var typeA = $("#type").children("a.am-btn-primary");
        if(typeA.text() == "进货单"){
            return type = 1;
        }else if(typeA.text() == "招投标评审"){
            return type = 2;
        }else{
            return type = 3;
        }
    }

    function chooseCheck(startTime,endTime,search,status,type,page){
        $.ajax({
            type: "GET",
            url : "/api/check/search",
            data: {
                startTime: startTime,
                endTime: endTime,
                search: search,
                status: status,
                type: type,
                page: page
            },
            dataType: "json",
            beforeSend:function(){
                $(".my-dark").css("display","block");
            },
            success: function(msg){

                console.log(msg)
                var data = msg['0'];
                var list;       
                console.log(data);
console.log(msg.type);
                if(msg.type == 1){

                    var listStatus,
                        go, //操作
                        code,
                        contactMan; 
                    if(!data){
                        list += '<tr class="gradeX"><td colspan="8">暂无数据</td></tr>';
                    }else{

                        for(var i = 0 ; i < data.length;i++ ){
//                            console.log(data[i].stockPutCode);
//                            code = data[i].needCode ? '<a href="/admin/check/detail?id='+ data[i].id +'&type='+ data[i].type +'&checkId='+ data[i].checkId +'&checkStatus='+ data[i].checkStatus +'">'+ data[i].needCode +'</a>' :
//                                    data[i].code ? '<a href="/admin/check/detail?id='+ data[i].id +'&type='+ data[i].type +'&checkId='+ data[i].checkId +'&checkStatus='+ data[i].checkStatus +'">'+ data[i].code +'</a>' :
//                                        data[i].purchaseCode ?    '<a href="/admin/check/detail?id='+ data[i].id +'&type='+ data[i].type +'&checkId='+ data[i].checkId +'&checkStatus='+ data[i].checkStatus +'">'+ data[i].purchaseCode +'</a>' :
//                                        data[i].stockOutCode ?    '<a href="/admin/check/detail?id='+ data[i].id +'&type='+ data[i].type +'&checkId='+ data[i].checkId +'&checkStatus='+ data[i].checkStatus +'">'+ data[i].stockOutCode +'</a>' :
//                                        data[i].stockPutCode ?    '<a href="/admin/check/detail?id='+ data[i].id +'&type='+ data[i].type +'&checkId='+ data[i].checkId +'&checkStatus='+ data[i].checkStatus +'">'+ data[i].stockPutCode +'</a>' :
//                            123123123;

                            if(data[i].needCode){
                                code = '<a href="/admin/check/detail?id='+ data[i].id +'&type='+ data[i].type +'&checkId='+ data[i].checkId +'&checkStatus='+ data[i].checkStatus +'">'+ data[i].needCode +'</a>';
                            }else if(data[i].code){
                                code = '<a href="/admin/check/detail?id='+ data[i].id +'&type='+ data[i].type +'&checkId='+ data[i].checkId +'&checkStatus='+ data[i].checkStatus +'">'+ data[i].code +'</a>';
                            }else if(data[i].purchaseCode){
                                code = '<a href="/admin/check/detail?id='+ data[i].id +'&type='+ data[i].type +'&checkId='+ data[i].checkId +'&checkStatus='+ data[i].checkStatus +'">'+ data[i].purchaseCode +'</a>';
                            }else if(data[i].stockOutCode){
                                code = '<a href="/admin/check/detail?id='+ data[i].id +'&type='+ data[i].type +'&checkId='+ data[i].checkId +'&checkStatus='+ data[i].checkStatus +'">'+ data[i].stockOutCode +'</a>';
                            }else if(data[i].stockPutCode){
                                code = '<a href="/admin/check/detail?id='+ data[i].id +'&type='+ data[i].type +'&checkId='+ data[i].checkId +'&checkStatus='+ data[i].checkStatus +'">'+ data[i].stockPutCode +'</a>';
                            }


                            contactMan = data[i].contactMan ? data[i].contactMan : '';

                            listStatus = data[i].status == '0' ? '待审核' :
                                    data[i].status == '1' ? '已审核' : '已审核';

                            go =  data[i].status == '0' ? '<div class="tpl-table-black-operation"><a href="/admin/check/edit?id='+ data[i].checkId +'&status=1&checkStatus='+ data[i].checkStatus +'&proId='+ data[i].id +'&type='+ data[i].type +'"><i class="am-icon-check"></i> 审核通过</a> <a href="/admin/check/edit?id='+ data[i].checkId +'&status=2&checkStatus='+ data[i].checkStatus +'&proId='+ data[i].id +'&type='+ data[i].type +'" class="tpl-table-black-operation-del"><i class="am-icon-close"></i> 审核拒绝</a></div>' :
                                     data[i].status == '1' ? '' : '<div class="tpl-table-black-operation"><a href="javascript:;"><i class="am-icon-pencil"></i> 审核拒绝</a></div>';

                            list += '<tr class="gradeX">'
                                    + '<td>'+ code +'</td>'
                                    + '<td>'+ data[i].type +'</td>'
                                    + '<td>'+ data[i].name +'</td>'
                                    + '<td>'+ data[i].createTime +'</td>'
                                    + '<td>'+ data[i].source +'</td>'
                                    + '<td>'+ contactMan +'</td>'
                                    + '<td>'+ listStatus +'</td>'
                                    + '<td>'+ go +'</td>'
                                 + '</tr>';
                        }

                    }
                    $(".choose-box").html(list);

                    //分页
                    //设置分页信息  
                    var pageOptions = {  
                        AllowPaging: true,  
                        PageIndex: msg.this_page,      //设置当前页码  
                        PageSize: msg.pageNum,       //设置分页大小  
                        RecordCount: msg.total_num,  //设置数据总数  
                        // TotalPage: ,      //设置总页数
                        showPageCount: 4,  
                        onPageClick: function(pageIndex) {
                            chooseCheck(startTime,endTime,search,status,type,pageIndex);
                        }  
                    }  
                    //初始化分页栏  
                    $('#paging').pageBar(pageOptions); 

                }else{
                    var code;

                    if(!data){
                        list += '<tr class="gradeX"><td colspan="8">暂无数据</td></tr>';
                    }else{
                        for(var i = 0 ; i < data.length;i++ ){

                            if(data[i].isType && data[i].isType == '招标项目定标'){
                                code = '<a href="/admin/bidding/confirmDetail?id='+ data[i].checkId +'&relevanceId='+ data[i].relevanceId +'">'+ data[i].code +'</a>';
                            }else{
                                code = '<a href="/admin/bidding/checkDetail?id='+ data[i].id +'">'+ data[i].code +'</a>'
                            }

                            list += '<tr class="gradeX">'
                                    + '<td>'+ code +'</td>'
                                    + '<td>'+ data[i].name +'</td>'
                                    + '<td>'+ data[i].createTime +'</td>'
                                    + '<td>招标金额</td>'
                                    + '<td>'+ data[i].address +'</td>'
                                    + '<td>'+ data[i].needAmount +'</td>';

                            if(data[i].isType && data[i].isType == '招标项目定标'){
                                if(data[i].status == 0){
                                    list += '<td>待定标</td>'
                                            + '<td>'
                                                +'<div class="tpl-table-black-operation">'
                                                    + ' <a href="/admin/bidding/confirmDetail?id='+ data[i].checkId +'&relevanceId='+ data[i].id +'"><i class="am-icon-pencil"></i> 去定标</a>'
                                                + '</div>'
                                            +'</td>'
                                        + '</tr>'
                                }else{
                                    list += '<td>已定标</td>'
                                            + '<td>'
                                                + '<div class="tpl-table-black-operation">'
                                                   
                                                + '</div>'
                                            +'</td>'
                                        + '</tr>';
                                }
                            }else{
                                if(data[i].status == 0){
                                    list += '<td>待评分</td>'
                                            + '<td>'
                                                + '<div class="tpl-table-black-operation">'
                                                    + ' <a href="/admin/bidding/checkEditView?id='+ data[i].id +'&checkId='+ data[i].checkId +'"><i class="am-icon-pencil"></i> 去评分</a>'
                                                + '</div>'
                                            +'</td>'
                                        + '</tr>'
                                }else if(data[i].status == 1){
                                    list += '<td>已评分</td>'
                                            + '<td>'
                                                + '<div class="tpl-table-black-operation">'
                                                   
                                                + '</div>'
                                            +'</td>'
                                        + '</tr>';
                                }
                            }
                        }
                    }
                    $(".choose-box").html(list);

                    //分页
                    //设置分页信息  
                    var pageOptions = {  
                        AllowPaging: true,  
                        PageIndex: msg.this_page,      //设置当前页码  
                        PageSize: msg.pageNum,       //设置分页大小  
                        RecordCount: msg.total_num,  //设置数据总数  
                        // TotalPage: ,      //设置总页数
                        showPageCount: 4,  
                        onPageClick: function(pageIndex) {
                            chooseCheck(startTime,endTime,search,status,type,pageIndex);
                        }  
                    }  
                    //初始化分页栏  
                    $('#paging').pageBar(pageOptions);
                }
            },
            complete:function(){
                $(".my-dark").css("display","none");
            },
            error: function (data) {  
                alert(XMLHttpRequest.status);
                alert(XMLHttpRequest.readyState);
               //  alert(textStatus);
            }
        });
    }
</script>
<script>
    $(document).ready(function() {  
        //设置分页信息  
        var pageOptions = {  
            AllowPaging: true,  
            PageIndex: <?php echo $_GET['page'] ?>,      //设置当前页码  
            PageSize: <?php echo $pageNum ?>,       //设置分页大小  
            RecordCount: <?php echo $totalNum ?>,  //设置数据总数  
            // TotalPage: ,      //设置总页数
            showPageCount: 4,  
            onPageClick: function(pageIndex) {  
                var type = '<?php echo isset($_GET['type'])  ? $_GET['type'] : 0 ?>';
                var page = parseInt(pageIndex);
                window.location.href = "?page="+ page +"&type="+ type;
                
            }  
        }  
        //初始化分页栏  
        $('#paging').pageBar(pageOptions);      
    })

</script>


</body>

</html>